//easy 常用操作JS
$(document).ready(function(){
	//绑定一些通用的参数
});
var tabId="#mainTabs";
openTopTab=function(title,url,recordParent,iconCls,callback,desc){
	if(top.UIManager)
		top.UIManager.Tab.open(url,function(){if(callback)callback();},title,desc);
	else{
		top.$(tabId).tabs('add',{
			title:title,
			content:'<iframe scrolling="auto" frameborder="0"  src="'+url+'" style="width:100%;height:100%;"></iframe>',
			iconCls:iconCls,
			closable:true
		});
	}
};

openFrameTab=function(title, url, recordParent,iconCls){
	var tab=findTab(title);
	if(tab!=null){
		$(tabId).tabs().tabs('update', {
			tab: tab,
			options:{
				selected:true
			}
		});
		return;
	}
	
	$(tabId).tabs('add',{
		title:title,
		content:'<iframe scrolling="auto" frameborder="0"  src="'+url+'" style="width:100%;height:100%;"></iframe>',
		iconCls:iconCls,
		closable:true
	});
};
findTab=function(title){
	var tab=null;
	var tabs=$(tabId).tabs('tabs');
	$(tabs).each(function(i){
		if(this.panel('options').title == title){
			tab=this;
			return false;
		}
	});
	return tab;
};

/**
 * 弹出方式的提示框，并显示给定提示信息
 * @param msg
 * @param title
 * @param icon:error,question,info,warning
 * @param fn
 */
showMsgDialog=function(msg,title,icon,fn){
	if(!title)title="提示信息";
	top.$.messager.alert(title,msg,icon,fn);
};

confirmMsgDialog=function(title,msg,fn){
	top.$.messager.confirm(title,msg,function(r){
		if(r){
			if(fn)fn();
		}
	});
};

_replaceError=function(msg){
	msg = msg.replace('<b>businessexception</b>','');
	msg = msg.replace('systemexception','');
	return msg;
};